/**
 * 列表初始化
 */
var TiXianPar = {
    id: "TiXianTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
TiXianPar.initColumn = function () {
    return [
        {title:'选择项',field: 'selectItem', radio: true},
        {title: '流水号', field: 'userId', visible: true, align: 'center', valign: 'middle'},
        {title: '分销商姓名', field: 'orderNo', visible: true, align: 'center', valign: 'middle'},
        {title: '分销商电话', field: 'orderNo', visible: true, align: 'center', valign: 'middle'},
        {title: '提现金额', field: 'orderNo', visible: true, align: 'center', valign: 'middle'},
        {title: '现金到账', field: 'orderNo', visible: true, align: 'center', valign: 'middle'},
        {title: '余额到账', field: 'orderNo', visible: true, align: 'center', valign: 'middle'},
        {title: '手续费', field: 'orderType', visible: true, align: 'center', valign: 'middle'},
        {title: '收款账户类型', field: 'orderType', visible: true, align: 'center', valign: 'middle'},
        {title: '收款人姓名', field: 'orderType', visible: true, align: 'center', valign: 'middle'},
        {title: '收款人账号', field: 'orderType', visible: true, align: 'center', valign: 'middle'},
        {title: '申请日期', field: 'settlementAt', visible: true, align: 'center', valign: 'middle'},
        {title: '状态', field: 'orderType', visible: true, align: 'center', valign: 'middle'},
        {title:"操作",field:'Button',events:operateEvents,formatter:TiXianPar.AddFunction}
    ];
};

TiXianPar.AddFunction = function(value,row,index){
    return [
        '<button id="unConfineMember" type="button" class="btn btn-primary">审核</button>'
    ].join("");
}

window.operateEvents = {
    'click #confineMember':function (e,value,row,index) {
        DisMemberInfo.confineMembers(1,row['disUserId']);
    },
    'click #unConfineMember':function (e,value,row,index) {
        DisMemberInfo.confineMembers(0,row['disUserId']);
    },
}

/**
 * 检查是否选中
 */
TiXianPar.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录！");
        return false;
    }else{
        TiXianPar.seItem = selected[0];
        return true;
    }
};

/**
 * 查询列表
 */
TiXianPar.search = function () {
    //带参查询
    TiXianPar.table.refresh({query: TiXianPar.formParams()});
};

//表单参数
TiXianPar.formParams = function() {
    var queryData = {};
    queryData['id'] = $("#id").val();
    queryData['userId'] = $("#userId").val();
    queryData['beginTime'] = $("#beginTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}

//在整个页面加载的时候
$(function () {
    //获取列表数据
    var defaultColunms = TiXianPar.initColumn();
    var table = new BSTable(TiXianPar.id, "/tixianlist/list", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(TiXianPar.formParams());
    TiXianPar.table = table.init();
});
